package com.example.lib_core.mvvm;

import androidx.lifecycle.LiveData;

import com.example.lib_core.api.Api;
import com.example.lib_core.bean.FoodBean;
import com.example.lib_core.bean.HeadlinesBean;
import com.example.lib_core.bean.NewsListBean;
import com.example.lib_core.bean.NewsTypeBean;
import com.example.lib_core.http.RetrofitManager;
import com.fhz.utilsfhz.ApiResponse;

import java.util.List;

public class BaseModel implements IModel {

    public LiveData<ApiResponse<List<FoodBean>>> getFood(){
        return RetrofitManager.getInstance()
                .getRetrofit("http://82.156.178.182:8082/")
                .create(Api.class)
                .getFoodBean();
    }

    public LiveData<ApiResponse<List<NewsTypeBean>>> getNewType(){
        return RetrofitManager.getInstance()
                .getRetrofit("http://82.156.178.182:8087/")
                .create(Api.class)
                .getNewTypeBean();
    }

    public LiveData<ApiResponse<List<NewsListBean>>> getNewList(){
        return RetrofitManager.getInstance()
                .getRetrofit("http://82.156.178.182:8087/")
                .create(Api.class)
                .getNewListBean();
    }

    public LiveData<ApiResponse<List<HeadlinesBean>>> getHeadlines(int newstype,int pagenum,int pagesize){
        return RetrofitManager.getInstance()
                .getRetrofit("http://82.156.178.182:8087/")
                .create(Api.class)
                .getHeadLinesBean(newstype, pagenum, pagesize);
    }
}
